#include "stdafx.h"
#include "DailyQuest.h"
#include "InstanceTouch.h"
#include <algorithm>
DECL_INSTANCE_TOUCH(ETouch_DailyQuest);

struct  DailyQuestDefReflectionRegister
{
	DailyQuestDefReflectionRegister()
	{
		REGISTER_REFLECTION_MEMBER(DailyQuest,m_iID,INVALID_ID).Editor_SetAsPrimaryKey();
		REGISTER_REFLECTION_MEMBER(DailyQuest,m_sDisplayName,std::string("DefaultName")).Editor_SetAsDisplayName();
		REGISTER_REFLECTION_MEMBER(DailyQuest,m_iOrder,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(DailyQuest,m_sIcon,std::string("")).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(DailyQuest,m_eType,EDailyQuestItemType_CostCash).Editor_SetAsEnumation<EDailyQuestItemType>();
		REGISTER_REFLECTION_MEMBER(DailyQuest,m_iTargetCount,1).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(DailyQuest,m_iRewardCashNum,1).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(DailyQuest,m_sDesc,std::string("")).Editor_SetAsRaw();

		GlobalClassManager::Instance().RegisterClass(DailyQuest::s_GetReflection(),eDefaultDef_DailyQuest);
		GlobalDefManager::Instance().RegisterDefManger(&DailyQuestManager::Instance());

	}
}___DailyQuestDefReflectionRegister;

rewrite  void DailyQuest::OnArchieveReaded()
{
}
static bool __compareQuestOrderLess(const DailyQuest* pA,const DailyQuest* pB)
{
	return pA->m_iOrder < pB->m_iOrder;
}
void DailyQuestManager::OnArchieveReaded()
{
	__DailyQuestManager::OnArchieveReaded();
	m_vQuests.clear();
	Enumerate(m_vQuests);
	std::sort(m_vQuests.begin(),m_vQuests.end(),__compareQuestOrderLess);
}